package com.english.tqc;

import java.util.HashMap;

import android.R.integer;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;

public class DetailActivity extends Activity{

	ImageButton btn_imgButton;
	EditText et_name;
	EditText et_mobilePhone;
	EditText et_familyPhone;
	EditText et_officePhone;
	EditText et_position;
	EditText et_company;
	EditText et_address;
	EditText et_zipCode;
	EditText et_email;
	EditText et_otherContact;
	EditText et_remark;
	EditText et_imageId;
	EditText et_privacy;
	HashMap map;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.detail);
		initEditText();
		et_name.setEnabled(false);
		Intent intent = getIntent();
		 map = (HashMap) intent.getSerializableExtra("usermap");
		 displayData();
	}

	private void setEditTextAbleFalse(){
		
		
	}
	private void setEditTextAbleTrue(){
		
	}
	private void initEditText() {
		et_name = (EditText)findViewById(R.id.et_name);
		et_mobilePhone = (EditText)findViewById(R.id.et_mobilephone);
		et_familyPhone = (EditText)findViewById(R.id.et_familyphone);
		et_officePhone = (EditText)findViewById(R.id.et_officephone);
		et_position = (EditText)findViewById(R.id.position);
		et_company = (EditText)findViewById(R.id.company);
		et_address = (EditText)findViewById(R.id.address);
		et_zipCode = (EditText)findViewById(R.id.zipcode);
		et_email = (EditText)findViewById(R.id.E_mail);
		et_otherContact = (EditText)findViewById(R.id.othercontact);
		et_remark = (EditText)findViewById(R.id.remark);
		btn_imgButton=(ImageButton)findViewById(R.id.btn_img);
	}
	private void displayData() {
		et_name.setText(String.valueOf(map.get("name")) );
		et_mobilePhone.setText(String.valueOf(map.get("mobilephone")));
		et_familyPhone.setText(String.valueOf(map.get("familyphone")));
		et_officePhone.setText(String.valueOf(map.get("officephone")));
		et_position.setText(String.valueOf(map.get("position")));
		et_company.setText(String.valueOf(map.get("company")));
		et_address.setText(String.valueOf(map.get("address")));
		et_zipCode.setText(String.valueOf(map.get("zipcode")));
		et_email.setText(String.valueOf(map.get("email")));
		et_otherContact.setText(String.valueOf(map.get("othercontact")));
		et_remark.setText(String.valueOf(map.get("remark")));
		btn_imgButton.setImageResource(Integer.parseInt(String.valueOf(map.get("imageid"))));
		
	}
}
